package com.lgc.kt_jetpack_android_edu.base

import android.graphics.Color
import android.os.Bundle
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.viewbinding.ViewBinding

/**
 *@fileName BaseActivity
 *@date2020/11/25  16:44
 *@author BaseActivity$
 *@describe TODO
 *@desc
 */
abstract class BaseActivity<T:ViewBinding>:AppCompatActivity() {
    private lateinit var _binding:T
    protected val binding get() =_binding

    override fun onCreate(savedInstanceState: Bundle?) {

        super.onCreate(savedInstanceState)
        //将状态栏和背景图融为一体
        val decorView = window.decorView
        decorView.systemUiVisibility = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE
        window.statusBarColor = Color.TRANSPARENT
        _binding=getViewBinding()
        setContentView(_binding.root)
        initData()
    }
    abstract fun initData()
    protected abstract fun getViewBinding():T


}



